package com.apes.enquiry.orderForm.service;

import com.apes.enquiry.orderForm.model.OrderFormDetail;
import com.apes.enquiry.orderForm.repository.OrderFormDetailRepository;
import com.apes.enquiry.product.repository.SpProductRepository;
import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import com.apes.framework.util.MapUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 类描述：
 *
 * @ClassName OrderFormDetailService
 * @Description 描述 供应商平台订单明细服务类
 * @Author lilong
 * @Date 2023/2/11 14:08
 * @Version 1.0
 */


@Service
public class OrderFormDetailService extends DomainService {

    @Autowired
    private OrderFormDetailRepository orderFormDetailRepository;
    @Autowired
    private SpProductRepository spProductRepository;


    public List<OrderFormDetail> findByOrderFormId(SimpleRequest request){
        List<OrderFormDetail> orderFormDetails = orderFormDetailRepository.finByOrderForm(request.getJO().getString("id"));
     /*   orderFormDetails.stream().forEach(item -> {
            item.setSpProduct(spProductRepository.findOne(item.getSpProduct().getId()));
        });*/
       return orderFormDetails;

    }

}
